package com.tran.demo.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.tran.demo.annotation.AuthAnnotation;
import com.tran.demo.entity.User;
import com.tran.demo.enums.ResultEnum;
import com.tran.demo.exception.MyException;
import com.tran.demo.service.IUserService;
import com.tran.demo.utils.RetResponse;
import com.tran.demo.utils.RetResult;

@RequestMapping("/user")
@RestController
public class UserController {

	@Autowired
	private IUserService userService;

	@GetMapping("/get/{userid}")
	@ResponseBody
	@AuthAnnotation(auth="vip")
	public RetResult<List<User>> hello(@PathVariable Integer userid) {
		Wrapper user = new EntityWrapper<User>();
		user.where("userid >= {0}", 10000).and("userid <= {0}", userid);
		return RetResponse.makeOKRsp(userService.selectList(user));
	}
}
